<template>
  <!-- 任务管理页面 -->
  <div class="box">
    <!-- <v-touch
      v-on:swipeleft="swiperleft"
      v-on:swiperight="swiperright"
      class="wrapper"
    > -->
    <van-tabs
      v-model="active"
      swipeable
      line-width="95px"
      title-active-color="#5C97F6"
      color="#4EB5FF"
      sticky
      @click="show_active"
    >
      <van-tab title="我负责">
        <!-- <van-sticky :offset-top="44"> -->
        <van-dropdown-menu>
          <van-dropdown-item
            title="任务类型"
            ref="task_event"
            v-model="task_value1"
            :options="task_option1"
            @change="click_task_event"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="时间"
            ref="task_responsibility_date"
          >
            <van-datetime-picker
              v-model="currentDate"
              type="date"
              :min-date="minDate"
              :max-date="maxDate"
              @confirm='show_time'
              @cancel="show_cancel"
            />
          </van-dropdown-item>
          <van-dropdown-item
            title="状态"
            v-model="task_value2"
            :options="task_option2"
            @change="click_task_status"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="更多"
            ref="item"
          >
            <i style="font-style:normal;font-size:12px">期待与您共创</i>
          </van-dropdown-item>
        </van-dropdown-menu>
        <van-row
          type="flex"
          justify="space-between"
          class="public_col"
        >
          <van-col span="4">
            <div style="color:#5C97F6">{{integralTask.haveInHand}}</div>进行中
          </van-col>
          <van-col span="4">
            <div>{{integralTask.toBeAccepted}}</div>验收中
          </van-col>
          <van-col span="4">
            <div style="color:#E70808">{{integralTask.beoverdue}}</div>逾期任务
          </van-col>
          <van-col span="4">
            <div>{{integralTask.reject}}</div>验收驳回
          </van-col>
          <van-col span="4">
            <div style="color:#17C78C">{{integralTask.adopt}}</div>任务完成
          </van-col>
        </van-row>
        <!-- </van-sticky> -->
        <van-pull-refresh
          v-model="isLoading"
          success-text="刷新成功"
          @refresh="onMyMission"
        >
          <van-list
            v-model="loading"
            :finished="finished"
            :offset="10"
            :immediate-check="false"
            finished-text="我是有底线的"
            @load="onLoadMission"
          >
            <div
              @click="show_responsibility(item1)"
              class="task_card"
              v-for="(item1,i) in arr"
              :key="i+'--'"
            >
              <div class="task_card_title clearfix">
                <div class="left">
                  <span v-if="item1.user_name.length<3">{{((item1.user_name.split("").reverse().join("")).substring(0,1)).split("").reverse().join("")}}</span>
                  <span v-else-if="item1.user_name.length>=3">{{((item1.user_name.split("").reverse().join("")).substring(0,2)).split("").reverse().join("")}}</span>
                </div>
                <div class="left">
                  <b>{{item1.task_title}}</b>
                  <div style="margin-left: 10px;">
                    任务类型：<i v-if='item1.is_recruit==1'>指派</i>
                    <i v-else-if='item1.is_recruit==0'>招募</i>
                    <i v-else-if='item1.is_recruit==2'>多人</i>
                  </div>
                </div>

                <div
                  class="right"
                  v-for="(ol,t) in task_option2"
                  :key="t+'--'"
                >
                  <div v-if="ol.value==item1.status">{{ol.text}}</div>
                </div>
              </div>
              <ul>
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/task_icon_1@2x.png">
                  </div>
                  <div class="left">
                    <div>
                      <span>验收人：</span><span>{{item1.check_name}}</span>
                    </div>
                    <div>
                      <span>逾期上限：</span><span>{{item1.overtime_end_day}}</span>
                    </div>
                  </div>

                </li>
                <li
                  class="clearfix"
                  style="margin-top:5px"
                >
                  <div class="task_Icon left"><img src="@/static/section/time_icon@2x.png"></div>
                  <div class="left">
                    <div>
                      <span>开始时间：</span><span>{{item1.start_time}}</span>
                    </div>
                    <div>
                      <span>结束时间：</span><span>{{item1.end_time}}</span>
                    </div>
                  </div>
                </li>
                <!-- <li></li> -->
                <li class="clearfix">
                  <div class="task_Icon left"><img
                      style="padding-top:8px"
                      src="@/static/section/renwujindu@2x.png"
                    ></div>
                  <div class="left">
                    <div>
                      <span>逾期扣分：</span><span>{{D_name}}：{{item1.overtime_code_d}}</span><span
                        style="margin-left:12px"
                        v-if="item1.overtime_code_c!=0 && ISC == 1"
                      >{{C_name}}：{{item1.overtime_code_c}}</span>
                    </div>
                    <div>
                      <span v-if='item1.is_recruit==0||item1.is_recruit==2'>完成加分：</span><span v-else-if='item1.is_recruit==1'>完成奖分：</span><span>{{D_name}}：{{item1.complete_code_d}}</span><span
                        v-if="item1.complete_code_c!=0 && ISC == 1"
                        style="margin-left:12px"
                      >{{C_name}}：{{item1.complete_code_c}}</span>
                    </div>
                    <div style="margin-top:13px">
                      <van-progress
                        :percentage="100"
                        stroke-width="4"
                        color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                      />
                      <div style="margin-top:10px;width:235px; text-align:center;font-size:10px;color:#808080">
                        <i v-if='item1.is_recruit==1'>任务进度</i><i v-else-if='item1.is_recruit==0||item1.is_recruit==2'>领取进度</i>
                      </div>
                    </div>
                  </div>
                </li>
                <!-- <li></li> -->
                <!-- <li>
                
                  </li> -->
              </ul>
              <p style="text-align:right"><span>详情>></span></p>
            </div>
          </van-list>
        </van-pull-refresh>
      </van-tab>
      <van-tab title="我发布">
        <!-- <van-sticky :offset-top="44"> -->
        <van-dropdown-menu>
          <van-dropdown-item
            title="任务类型"
            ref="task_event"
            v-model="task_value1"
            :options="task_option1"
            @change="click_task_event"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="时间"
            ref="task_relase_date"
          >
            <van-datetime-picker
              v-model="currentDate"
              type="date"
              :min-date="minDate"
              :max-date="maxDate"
              @confirm='show_time'
              @cancel="show_cancel"
            />
          </van-dropdown-item>
          <van-dropdown-item
            title="状态"
            v-model="release_show"
            :options="release_status"
            @change="show_status_relase"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="更多"
            ref="item"
          >
            <i style="font-style:normal;font-size:12px">期待与您共创</i>
          </van-dropdown-item>
        </van-dropdown-menu>
        <van-row
          type="flex"
          justify="space-between"
          class="public_col"
        >
          <van-col span="4">
            <div style="color:#5C97F6">{{integralTask.haveInHand}}</div>进行中
          </van-col>
          <van-col span="4">
            <div>{{integralTask.toBeAccepted}}</div>验收中
          </van-col>
          <van-col span="4">
            <div style="color:#E70808">{{integralTask.beoverdue}}</div>逾期任务
          </van-col>
          <van-col span="4">
            <div>{{integralTask.reject}}</div>验收驳回
          </van-col>
          <van-col span="4">
            <div style="color:#17C78C">{{integralTask.adopt}}</div>任务完成
          </van-col>
        </van-row>
        <!-- </van-sticky> -->
        <van-pull-refresh
          v-model="isLoading"
          success-text="刷新成功"
          @refresh="onReleased"
        >
          <van-list
            v-model="loading"
            :finished="finished"
            :offset="10"
            :immediate-check="false"
            finished-text="我是有底线的"
            @load="onLoadReleased"
          >
            <div
              class="task_card"
              v-for="(item4,i) in released"
              :key="i+'info++'"
            >
            <div  @click="showDetails(item4,2)">
              <div class="task_card_title clearfix">               
                <div class="left">
                  <span v-if="item4.create_name.length<3">{{((item4.create_name.split("").reverse().join("")).substring(0,1)).split("").reverse().join("")}}</span>
                  <span v-else-if="item4.create_name.length>=3">{{((item4.create_name.split("").reverse().join("")).substring(0,2)).split("").reverse().join("")}}</span>
                </div>
                <div class="left">
                  <b>{{item4.task_title}}</b>
                  <div style="margin-left: 10px;">任务类型：<i v-if='item4.is_recruit==1'>指派</i><i v-else-if='item4.is_recruit==0'>招募</i><i v-else-if='item4.is_recruit==2'>多人</i></div>
                </div>
                <div
                  class="right"
                  v-for="(it,o) in release_status"
                  :key="o+'i++'"
                >
                  <div v-if="item4.status==it.value">{{it.text}}</div>
                </div>
              </div>
              <ul>
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/task_icon_1@2x.png">
                  </div>
                  <div class="left">
                    <div>
                      <span v-if='item4.is_recruit==0||item4.is_recruit==2'>领取得分：</span><span v-else-if='item4.is_recruit==1'>完成奖分：</span><span>{{D_name}}：{{item4.complete_code_d}}</span><span
                        v-if="item4.complete_code_c!=0 && ISC == 1"
                        style="margin-left:12px"
                      >{{C_name}}：{{item4.complete_code_c}}</span>
                    </div>
                    <div>
                      <span>逾期扣分：</span><span>{{D_name}}：{{item4.overtime_code_d}}</span><span
                        style="margin-left:12px"
                        v-if="item4.overtime_code_c!=0 && ISC == 1"
                      >{{C_name}}：{{item4.overtime_code_c}}</span>
                    </div>
                  </div>
                </li>
                <li
                  class="clearfix"
                  style="margin-top:5px"
                >
                  <div class="task_Icon left"><img src="@/static/section/time_icon@2x.png"></div>
                  <div class="left">
                    <div>
                      <span>开始时间：</span><span>{{item4.start_time}}</span>
                    </div>
                    <div>
                      <span>结束时间：</span><span>{{item4.end_time}}</span>
                    </div>
                  </div>
                </li>
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/renwujindu@2x.png"></div>
                  <div
                    class="left"
                    style="margin-top:13px"
                  >
                    <van-progress
                      v-if="item4.actual_task_sum==item4.operation_task_sum"
                      :percentage="100"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <van-progress
                      v-if="item4.operation_task_sum<item4.actual_task_sum&&item4.operation_task_sum>0"
                      :percentage="50"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <van-progress
                      v-if="item4.operation_task_sum==0"
                      :percentage="0"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <div style="margin-top:10px;width:235px; text-align:center;font-size:10px;color:#808080">
                      <i v-if='item4.is_recruit==1'>任务进度</i><i v-else-if='item4.is_recruit==0||item4.is_recruit==2'>领取进度</i>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
              <p style="text-align:right"><span v-if='item4.status==7' style="margin-right:10px" @click="oneMoreTime(item4.id)">再来一次</span><span @click="showDetails(item4,2)">详情>></span></p>
            </div>
          </van-list>
        </van-pull-refresh>
      </van-tab>
      <van-tab title="我审核">
        <!-- <van-sticky :offset-top="44"> -->
        <van-dropdown-menu>
          <van-dropdown-item
            title="任务类型"
            v-model="task_value1"
            :options="task_option1"
            @change="click_task_event"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="时间"
            ref="task_audit_date"
          >
            <van-datetime-picker
              v-model="currentDate"
              type="date"
              :min-date="minDate"
              :max-date="maxDate"
              @confirm='show_time'
              @cancel="show_cancel"
            />
          </van-dropdown-item>
          <van-dropdown-item
            title="状态"
            v-model="audit_show"
            :options="audit_status"
            @change="show_status_audit"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="更多"
            ref="item"
          >
            <i style="font-style:normal;font-size:12px">期待与您共创</i>
          </van-dropdown-item>
        </van-dropdown-menu>
        <van-row
          type="flex"
          justify="space-between"
          class="public_col"
        >
          <van-col span="4">
            <div style="color:#5C97F6">{{integralTask.haveInHand}}</div>进行中
          </van-col>
          <van-col span="4">
            <div>{{integralTask.toBeAccepted}}</div>验收中
          </van-col>
          <van-col span="4">
            <div style="color:#E70808">{{integralTask.beoverdue}}</div>逾期任务
          </van-col>
          <van-col span="4">
            <div>{{integralTask.reject}}</div>验收驳回
          </van-col>
          <van-col span="4">
            <div style="color:#17C78C">{{integralTask.adopt}}</div>任务完成
          </van-col>
        </van-row>
        <!-- </van-sticky> -->
        <van-pull-refresh
          v-model="isLoading"
          success-text="刷新成功"
          @refresh="onMyAudit"
        >
          <van-list
            v-model="loading"
            :finished="finished"
            :offset="10"
            :immediate-check="false"
            finished-text="我是有底线的"
            @load="onLoadAudit"
          >
            <div
              class="task_card"
              @click="showDetails(item2,3)"
              v-for="(item2,i) in audit"
              :key="i+'info--'"
            >
              <div class="task_card_title clearfix">
                <div class="left">
                  <span v-if="item2.create_name.length<3">{{((item2.create_name.split("").reverse().join("")).substring(0,1)).split("").reverse().join("")}}</span>
                  <span v-else-if="item2.create_name.length>=3">{{((item2.create_name.split("").reverse().join("")).substring(0,2)).split("").reverse().join("")}}</span>
                </div>
                <div
                  class="left"
                  style="padding-top:8px"
                >
                  <b>{{item2.task_title}}</b>

                </div>
                <!-- <span></span> -->
                <div
                  class="right"
                  v-for="(dl,t) in audit_status"
                  :key="t+'++'"
                >
                  <div v-if="dl.value==item2.status">{{dl.text}}</div>
                </div>
              </div>
              <ul>
                <!-- <li></li> -->
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/task_icon_1@2x.png">
                  </div>
                  <div class="left">
                    <div>任务类型：<i v-if='item2.is_recruit==1'>指派</i><i v-else-if='item2.is_recruit==0'>招募</i><i v-else-if='item2.is_recruit==2'>多人</i></div>
                    <span v-if='item2.is_recruit==0||item2.is_recruit==2'>领取得分：</span><span v-else-if='item2.is_recruit==1'>完成奖分：</span><span>{{D_name}}：{{item2.complete_code_d}}</span><span
                      v-if="item2.complete_code_c!=0 && ISC == 1"
                      style="margin-left:12px"
                    >{{C_name}}：{{item2.complete_code_c}}</span>
                  </div>
                </li>
                <li
                  class="clearfix"
                  style="margin-top:5px"
                >
                  <div class="task_Icon left"><img src="@/static/section/time_icon@2x.png"></div>
                  <div class="left">
                    <div>
                      <span>开始时间：</span><span>{{item2.start_time}}</span>
                    </div>
                    <div>
                      <span>结束时间：</span><span>{{item2.end_time}}</span>
                    </div>
                  </div>
                </li>
                <!-- <li></li> -->
                <!-- <li><span>子任务数量：</span><span>{{item2.actual_task_sum}}</span></li>
              <li><span>已领取数量：</span><span>{{item2.operation_task_sum}}</span></li>
              <li><span>未领取数量：</span><span>{{item2.actual_task_sum-item2.operation_task_sum}}</span></li> -->
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/renwujindu@2x.png"></div>
                  <div
                    class="left"
                    style="margin-top:13px"
                  >
                    <van-progress
                      v-if="item2.actual_task_sum==item2.operation_task_sum"
                      :percentage="100"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <van-progress
                      v-if="item2.operation_task_sum<item2.actual_task_sum&&item2.operation_task_sum>0"
                      :percentage="50"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <van-progress
                      v-if="item2.operation_task_sum==0"
                      :percentage="0"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <div style="margin-top:10px;width:235px; text-align:center;font-size:10px;color:#808080">
                      <i v-if='item2.is_recruit==1'>任务进度</i><i v-else-if='item2.is_recruit==0||item2.is_recruit==2'>领取进度</i>
                    </div>
                  </div>
                </li>
              </ul>
              <p style="text-align:right"><span>详情>></span></p>
            </div>
          </van-list>
        </van-pull-refresh>
      </van-tab>
      <van-tab title="我验收">
        <!-- <van-sticky :offset-top="44"> -->
        <van-dropdown-menu>
          <van-dropdown-item
            title="任务类型"
            v-model="task_value1"
            :options="task_option1"
            @change="click_task_event"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="时间"
            ref="task_date"
          >
            <van-datetime-picker
              v-model="currentDate"
              type="date"
              :min-date="minDate"
              :max-date="maxDate"
              @confirm='show_time'
              @cancel="show_cancel"
            />
          </van-dropdown-item>
          <van-dropdown-item
            title="状态"
            v-model="acceptance_show"
            :options="acceptance_status"
            @change="show_status_acceptance"
          >
          </van-dropdown-item>
          <van-dropdown-item
            title="更多"
            ref="item"
          >
            <i style="font-style:normal;font-size:12px">期待与您共创</i>
          </van-dropdown-item>
        </van-dropdown-menu>
        <van-row
          type="flex"
          justify="space-between"
          class="public_col"
        >
          <van-col span="4">
            <div style="color:#5C97F6">{{integralTask.haveInHand}}</div>进行中
          </van-col>
          <van-col span="4">
            <div>{{integralTask.toBeAccepted}}</div>验收中
          </van-col>
          <van-col span="4">
            <div style="color:#E70808">{{integralTask.beoverdue}}</div>逾期任务
          </van-col>
          <van-col span="4">
            <div>{{integralTask.reject}}</div>验收驳回
          </van-col>
          <van-col span="4">
            <div style="color:#17C78C">{{integralTask.adopt}}</div>任务完成
          </van-col>
        </van-row>
        <!-- </van-sticky> -->
        <van-pull-refresh
          v-model="isLoading"
          success-text="刷新成功"
          @refresh="onMyAcceptance"
        >

          <van-list
            v-model="loading"
            :finished="finished"
            :offset="10"
            :immediate-check="false"
            finished-text="我是有底线的"
            @load="onLoadAcceptance"
          >
            <div
              class="task_card"
              @click="showCheck_list(item3)"
              v-for="(item3,i) in acceptance"
              :key="i+'info++'"
            >
              <div class="task_card_title clearfix">

                <div class="left">
                  <span v-if="item3.create_name.length<3">{{((item3.create_name.split("").reverse().join("")).substring(0,1)).split("").reverse().join("")}}</span>
                  <span v-else-if="item3.create_name.length>=3">{{((item3.create_name.split("").reverse().join("")).substring(0,2)).split("").reverse().join("")}}</span>
                </div>
                <div class="left">
                  <b>{{item3.task_title}}</b>
                  <div style="margin-left: 10px;">
                    任务类型：<i v-if='item3.is_recruit==1'>指派</i><i v-else-if='item3.is_recruit==0'>招募</i><i v-else-if='item3.is_recruit==2'>多人</i>
                  </div>
                </div>
                <!-- <span></span> -->
                <div
                  class="right"
                  v-for="(dd,o) in acceptance_status"
                  :key="o+'i++'"
                >
                  <div v-if="item3.ustatus==dd.value">{{dd.text}}</div>
                </div>
              </div>
              <ul>
                <li class="clearfix">
                  <div class="left" style="margin-bottom:10px"><span style="margin:10px 34px">负责人：{{item3.user_name}}</span></div>
                </li>
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/task_icon_1@2x.png"></div>
                  <div class="left">
                    <div>
                      <span v-if='item3.is_recruit==0||item3.is_recruit==2'>领取得分：</span><span v-else-if='item3.is_recruit==1'>完成奖分：</span><span>{{D_name}}：{{item3.complete_code_d}}</span><span
                        v-if="item3.complete_code_c!=0 && ISC == 1"
                        style="margin-left:12px"
                      >{{C_name}}：{{item3.complete_code_c}}</span>
                    </div>
                    <div>
                      <span>逾期扣分：</span><span>{{D_name}}：{{item3.overtime_code_d}}</span><span
                        style="margin-left:12px"
                        v-if="item3.overtime_code_c!=0 && ISC == 1"
                      >{{C_name}}：{{item3.overtime_code_c}}</span>
                    </div>
                  </div>
                </li>
                <!-- <li>
                  <span>开始时间：</span><span>{{item3.start_time}}</span></li>
                <li><span>结束时间：</span><span>{{item3.end_time}}</span></li> -->
                <li
                  class="clearfix"
                  style="margin-top:5px"
                >
                  <div class="task_Icon left"><img src="@/static/section/time_icon@2x.png"></div>
                  <div class="left">
                    <div>
                      <span>开始时间：</span><span>{{item3.start_time}}</span>
                    </div>
                    <div>
                      <span>结束时间：</span><span>{{item3.end_time}}</span>
                    </div>
                  </div>
                </li>
                <li class="clearfix">
                  <div class="task_Icon left"><img src="@/static/section/renwujindu@2x.png"></div>
                  <div
                    class="left"
                    style="margin-top:13px"
                  >
                    <van-progress
                      :percentage="100"
                      stroke-width="4"
                      color="linear-gradient(to right, #4CB1FF, #7FD6FF)"
                    />
                    <div style="margin-top:10px;width:235px; text-align:center;font-size:10px;color:#808080">
                      <i v-if='item3.is_recruit==1'>任务进度</i><i v-else-if='item3.is_recruit==0||item3.is_recruit==2'>领取进度</i>
                    </div>
                  </div>
                </li>
              </ul>
              <p style="text-align:right"><span>详情>></span></p>
            </div>
          </van-list>
        </van-pull-refresh>
      </van-tab>
    </van-tabs>
    <Plus />
    <!-- </v-touch> -->
  </div>
</template>

<script type="text/javascript">
import Plus from "@/components/plus";
import {
  List,
  Tab,
  Tabs,
  Row,
  Col,
  Icon,
  Popup,
  RadioGroup,
  Radio,
  Cell,
  CellGroup,
  Progress,
  DropdownMenu,
  DropdownItem,
  PullRefresh,
  Sticky
} from "vant";
import { DatetimePicker } from "vant";
export default {
  data() {
    return {
      active: 0,
      radio: "1",
      show: false,
      type: false,
      // status_list: false,
      res: false,
      // release: false,
      // rtype: false,
      // verif: false,
      // show_await: false,
      // all: false,
      // check: false,
      // await_check: false,
      // check_all: false,
      // time: false,
      date: undefined,
      // res_time: false,
      // await_time: false,
      // check_time: false,
      // verif_time: false,
      list: [],
      arr: [],
      audit: [],
      acceptance: [],
      released: [],
      task_option2: [
        { text: "全部", value: 8 },
        { text: "进行中", value: 0 },
        { text: "验收中", value: 1 },
        { text: "驳回", value: 2 },
        { text: "已完成", value: 3 },
        { text: "已逾期", value: 4 }
        // { text: "主任务待审核", value: 5 },
        // { text: "审核驳回", value: 6 },
        // { text: "完成", value: 7 }
      ],
      audit_status: [
        { text: "全部", value: 8 },
        { text: "待审核", value: 0 },
        { text: "未通过", value: 1 },
        { text: "通过", value: 4 }
      ],
      acceptance_status: [
        { text: "全部", value: 8 },
        { text: "验收中", value: 1 },
        { text: "驳回", value: 2 },
        { text: "已完成", value: 3 }
      ],
      release_status: [
        { text: "全部", value: 8 },
        { text: "审核中", value: 0 },
        {
          text: "未通过",
          value: 1
        },
        {
          text: "进行中",
          value: 4
        },
        { text: "结束", value: 7 }
      ],
      loading: false, // 上拉加载
      finished: false, // 上拉加载完毕
      offset: 100, // 滚动条与底部距离小于 offset 时触发load事件
      pageSize: 10, // 每页条数
      pageIndex: 1, // 页码
      page_1: 0,
      page_2: 0,
      page_3: 0,
      page_4: 0,
      c: 8,
      d: 8,
      e: 8,
      f: 8,
      g: 8,
      h: 8,
      i: 8,
      k: 8,
      minDate: new Date(2018, 0),
      maxDate: new Date(),
      currentDate: new Date(),
      data_time_one: "",
      data_time_two: "",
      data_time_three: "",
      data_time_four: "",
      data_time_five: "",
      userId_p: 0,
      corpId_p: 0,
      task_dateTime: "",
      task_option1: [
        { text: "全部", value: 8 },
        { text: "招募", value: 0 },
        { text: "指派", value: 1 }
      ],
      task_value1: 8,
      task_value2: 8,
      release_show: 8,
      audit_show: 8,
      acceptance_show: 8,
      integralTask: {},
      C_name: "",
      D_name: "",
      isLoading: false,
      ISC:''
    };
  },
  components: {
    [Tab.name]: Tab,
    [Tabs.name]: Tabs,
    [Row.name]: Row,
    [Col.name]: Col,
    [Icon.name]: Icon,
    [Popup.name]: Popup,
    [RadioGroup.name]: RadioGroup,
    [Radio.name]: Radio,
    [Cell.name]: Cell,
    [CellGroup.name]: CellGroup,
    [DatetimePicker.name]: DatetimePicker,
    [List.name]: List,
    [Progress.name]: Progress,
    [DropdownMenu.name]: DropdownMenu,
    [DropdownItem.name]: DropdownItem,
    [PullRefresh.name]: PullRefresh,
    [Sticky.name]: Sticky,
    Plus
  },
  created() {
    this.C_name = localStorage.getItem("c_name");
    this.D_name = localStorage.getItem("d_name");
    this.userId_p = localStorage.getItem("userId");
    this.corpId_p = localStorage.getItem("custid");
    this.myMission(8, 8, 0);
    this.getIntegralTask();
    this.getIsC();
    if (this.$route.query.active != undefined) {
      this.active = this.$route.query.active;
      if (this.active == 1) {
        this.Released(8, 8, 0);
      }
      if (this.active == 2) {
        this.myAudit(0, 8, 0);
      }
      if (this.active == 3) {
        this.myAcceptance(1, 8, 0);
      }
    }
    dd.biz.navigation.setTitle({
      title: "任务" //控制标题文本，空字符串表示显示默认文本
    });
  },
  methods: {
     //C分开关
    async getIsC(){
      let corpId = localStorage.getItem("custid");
      const res = await this.$http.get(
        `yuepoints/getIsC?corpId=${corpId}`
      );
      // localStorage.setItem("ISC", res.data.data.is_c_code);
      this.ISC = res.data.data.is_c_code
    },
    // 我发布再来一次
    oneMoreTime(id){
       this.$router.push({
          //核心语句
          path: "/release", //跳转的路径
          query: {
            id: id,
            type:6
          }
       })
    },
    show_active() {
      if (this.active == 0) {
        this.task_value1 = 8;
        this.task_value2 = 8;
        this.currentDate = new Date();
        this.myMission(8, 8, 0);
      }
      if (this.active == 1) {
        this.task_value1 = 8;
        this.release_show = 8;
        this.currentDate = new Date();
        this.Released(8, 8, 0);
      }
      if (this.active == 2) {
        this.task_value1 = 8;
        this.audit_show = 0;
        this.currentDate = new Date();
        this.myAudit(0, 8, 0);
      }
      if (this.active == 3) {
        this.task_value1 = 8;
        this.acceptance_show = 1;
        this.currentDate = new Date();
        this.myAcceptance(1, 8, 0);
      }
    },
    //下拉刷新
    onMyMission() {
      setTimeout(() => {
        this.isLoading = false;
        this.myMission(8, 8, 0);
      }, 1000);
    },
    onReleased() {
      setTimeout(() => {
        this.isLoading = false;
        this.Released(8, 8, 0);
      }, 1000);
    },
    onMyAudit() {
      setTimeout(() => {
          this.isLoading = false;
          this.myAudit(8, 8, 0);
      }, 1000);
    },
    onMyAcceptance() {
      setTimeout(() => {
        this.isLoading = false;
        this.myAcceptance(8, 8, 0);
      }, 1000);
    },
    // 状态展示接口
    async getIntegralTask() {
      const res = await this.$http.get(
        `yuepoints/getIntegralTask?corpId=${this.corpId_p}&userId=${this.userId_p}`
      );
      this.integralTask = res.data.data.integralTask;
    },
    // 时间取消按钮
    show_cancel() {
      if (this.active == 0) {
        this.currentDate = new Date();
        this.data_time_two = "";
        this.myMission(8, 8, 0);
        this.$refs.task_responsibility_date.toggle();
      }
      if (this.active == 1) {
        this.data_time_three = "";
        this.currentDate = new Date();
        this.Released(8, 8, 0, "");
        this.$refs.task_relase_date.toggle();
      }
      if (this.active == 2) {
        this.currentDate = new Date();
        this.data_time_four = "";
        this.myAudit(8, 8, 0, "");
        this.$refs.task_audit_date.toggle();
      }
      if (this.active == 3) {
        this.data_time_five = "";
        this.currentDate = new Date();
        this.myAcceptance(8, 8, 0, "");
        this.$refs.task_date.toggle();
      }
    },
    // 时间筛选
    show_time(time) {
      const d = new Date(time);
      let yy = d.getFullYear();
      let mm = this.p(d.getMonth() + 1);
      let dd = this.p(d.getDate());
      const resDate = yy + "-" + mm + "-" + dd;

      if (this.active == 0) {
        this.$refs.task_responsibility_date.toggle();
        this.data_time_two = resDate;
        this.myMission(8, 8, 0, resDate);
      }
      if (this.active == 1) {
        this.data_time_three = resDate;
        this.Released(8, 8, 0, resDate);
        this.$refs.task_relase_date.toggle();
      }
      if (this.active == 2) {
        this.$refs.task_audit_date.toggle();
        this.data_time_four = resDate;
        this.myAudit(8, 8, 0, resDate);
      }
      if (this.active == 3) {
        this.$refs.task_date.toggle();
        this.data_time_five = resDate;
        this.myAcceptance(8, 8, 0, resDate);
      }
    },
    p(s) {
      return s < 10 ? "0" + s : s;
    },
    // 我发布上拉加载
    onLoadReleased() {
      const p = this.page_4;
      const a = this.i;
      const b = this.k;
      this.pageIndex++;
      this.Released(a, b, p, this.data_time_three);
    },
    // 验收上拉加载
    onLoadAcceptance() {
      const p = this.page_3;
      const a = this.g;
      const b = this.h;
      this.pageIndex++;
      this.myAcceptance(a, b, p, this.data_time_five);
    },
    // 我审核上拉加载
    onLoadAudit() {
      const p = this.page_2;
      const a = this.e;
      const b = this.f;
      this.pageIndex++;
      this.myAudit(a, b, p, this.data_time_four);
    },
    // 我负责上拉加载
    onLoadMission() {
      this.pageIndex++;
      this.myMission(this.c, this.d, this.page_1, this.data_time_two);
    },
    // 我发布
    show_status_relase() {
      this.i = this.release_show;
      if (this.release_show == 8) {
        this.Released(8, 8, 0);
      } else {
        this.pageIndex = 1;
        this.page_4 = 0;
        this.Released(this.release_show, 8, 0, this.data_time_three);
      }
    },
    
    // 我验收筛选
    show_status_acceptance() {
      this.g = this.acceptance_show;
      if (this.acceptance_show == 8) {
        this.myAcceptance(this.acceptance_show, 8, 0);
      } else {
        this.page_3 = 0;
        this.pageIndex = 1;
        this.myAcceptance(this.acceptance_show, 8, 0, this.data_time_five);
      }
    },
    
    // 我审核的状态筛选
    show_status_audit() {
      this.e = this.audit_show;
      if (this.audit_show == 8) {
        this.myAudit(this.audit_show, 8, 0);
      } else {
        this.page_2 = 0;
        this.pageIndex = 1;
        this.myAudit(this.audit_show, 8, 0, this.data_time_four);
      }
    },
    // 我负责筛选情况
    click_task_status() {
      this.c = this.task_value2;
      if (this.task_value2 == 8) {
        this.myMission(8, 8, 0);
      } else {
        this.page_1 = 0;
        this.pageIndex = 1;
        this.myMission(this.task_value2, 8, 0, this.data_time_two);
      }
    },
    click_task_event() {
      if (this.active == 0) {
        this.d = this.task_value1;
        if (this.task_value1 == 8) {
          this.myMission(8, 8, 0);
        } else {
          this.page_1 = 0;
          this.pageIndex = 1;
          this.myMission(8, this.task_value1, 0, this.data_time_two);
        }
      }
      if (this.active == 1) {
        this.k = this.task_value1;
        if (this.task_value1 == 8) {
          this.Released(8, this.task_value1, 0);
        } else {
          this.page_4 = 0;
          this.pageIndex = 1;
          this.Released(8, this.task_value1, 0, this.data_time_three);
        }
      }
      if (this.active == 2) {
        this.f = this.task_value1;
        if (this.task_value1 == 8) {
          this.myAudit(8, this.task_value1, 0);
        } else {
          this.page_2 = 0;
          this.pageIndex = 1;
          this.myAudit(8, this.task_value1, 0, this.data_time_four);
        }
      }
      if (this.active == 3) {
        this.h = this.task_value1;
        if (this.task_value1 == 8) {
          this.myAcceptance(8, this.task_value1, 0);
        } else {
          this.page_3 = 0;
          this.pageIndex = 1;
          this.myAcceptance(8, this.task_value1, 0, this.data_time_five);
        }
      }
    },
    // 我发布
    async Released(i, num, cursor, year) {
      if (year == undefined) {
        year = "";
      }
      await this.$http
        .get(
          `/yuepoints/iReleased?corpId=${this.corpId_p}&userId=${this.userId_p}&status=${i}&type=${num}&cursor=${cursor}&date=${year}`
        )
        .then(res => {
          const { data, cursor, errcode } = res.data;
          this.$forceUpdate();
          if (errcode == "0000") {
            if (data.length === 0 || data === null) {
              this.finished = true;
              this.released = [];
              return;
            }
            if (data.length < this.pageSize) {
              this.finished = true;
            }
            if (this.pageIndex === 1) {
              this.released = data;
            } else {
              this.released = this.released.concat(data);
            }
            if (cursor > 0) {
              this.page_4 = cursor;
            }
          } else {
            this.released = [];
            this.finished = true;
          }
        })
        .finally(() => {
          this.loading = false;
        });
      
    },
    // 我验收
    async myAcceptance(i, num, cursor, year) {
      if (year == undefined) {
        year = "";
      }
      const res = await this.$http
        .get(
          `/yuepoints/myAcceptance?corpId=${this.corpId_p}&userId=${this.userId_p}&status=${i}&type=${num}&cursor=${cursor}&date=${year}`
        )
        .then(res => {
          const { data, cursor, errcode } = res.data;
          this.$forceUpdate();
          if (errcode == "0000") {
            if (data.length === 0 || data === null) {
              this.finished = true;
              return;
            }
            if (data.length < this.pageSize) {
              this.finished = true;
            }
            if (this.pageIndex === 1) {
              this.acceptance = data;
            } else {
              this.acceptance = this.acceptance.concat(data);
            }
            if (cursor > 0) {
              this.page_3 = cursor;
            }
          } else {
            this.acceptance = [];
            this.finished = true;
          }
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // 我的审核
    async myAudit(i, num, cursor, year) {
      if (year == undefined) {
        year = "";
      }
      const res = await this.$http
        .get(
          `/yuepoints/Task/myAudit?corpId=${this.corpId_p}&userId=${this.userId_p}&status=${i}&type=${num}&cursor=${cursor}&date=${year}`
        )
        .then(res => {
          const { data, cursor, errcode } = res.data;
          this.$forceUpdate();
          if (errcode == "0000") {
            if (data.length === 0 || data === null) {
              this.finished = true;
              return;
            }
            if (data.length < this.pageSize) {
              this.finished = true;
            }
            if (this.pageIndex === 1) {
              this.audit = data;
            } else {
              this.audit = this.audit.concat(data);
            }
            if (cursor > 0) {
              this.page_2 = cursor;
            }
          } else {
            this.audit = [];
            this.finished = true;
          }
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // 我负责
    async myMission(i, num, cursor, year) {
      if (year == undefined) {
        year = "";
      }
      const res = await this.$http
        .get(
          `/yuepoints/myMission?corpId=${this.corpId_p}&userId=${this.userId_p}&status=${i}&type=${num}&cursor=${cursor}&date=${year}`
        )
        .then(res => {
          const { data, cursor, errcode } = res.data;
          if (errcode == "0000") {
            this.$forceUpdate();
            if (data.length === 0 || data === null || data == "") {
              this.finished = true;
              return;
            }
            if (data.length < this.pageSize) {
              this.finished = true;
            }
            if (this.pageIndex === 1) {
              this.arr = data;
            } else {
              this.arr = this.arr.concat(data);
            }
            if (cursor > 0) {
              this.page_1 = cursor;
            }
          } else {
            this.arr = [];
            this.finished = true;
          }
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // 我审核，我发布跳转详情页
    showDetails(it, i) {
      if (it.is_recruit == 1) {
        this.$router.push({
          //核心语句
          path: "/details", //跳转的路径
          query: {
            //路由传参时push和query搭配使用 ，作用时传递参数
            id: it.id,
            type: i,
            status: it.status
          }
        });
      } else {
        this.$router.push({
          //核心语句
          path: "/details_recruit", //跳转的路径
          query: {
            //路由传参时push和query搭配使用 ，作用时传递参数
            id: it.id,
            type: i,
            status: it.status
          }
        });
      }
    },
    // 我负责跳转详情
    show_responsibility(it) {
      this.$router.push({
        //核心语句
        path: "/responsibility", //跳转的路径
        query: {
          //路由传参时push和query搭配使用 ，作用时传递参数
          id: it.id
        }
      });
    },
    //验收详情页
    showCheck_list(it) {
      this.$router.push({
        //核心语句
        path: "/check_list", //跳转的路径
        query: {
          //路由传参时push和query搭配使用 ，作用时传递参数
          id: it.uid
        }
      });
    }
  }
};
</script>

<style lang="less" scoped>
.box {
  padding-bottom: 50px;
  background: #f8f8fa;
  -webkit-overflow-scrolling: touch;
  height: -webkit-calc(100% - 50px);
  height: -moz-calc(100% - 50px);
  height: calc(100% - 50px);
  .wrapper {
    touch-action: pan-y !important;
  }
  /deep/ .van-sticky {
    background: #fff;
  }
  /deep/ .van-tabs__wrap {
    padding: 0px 8px;
  }
  /deep/ .van-dropdown-menu {
    background: #f8f8fa;
  }
  /deep/ .van-ellipsis {
    font-size: 14px;
  }
  /deep/ .van-sticky--fixed {
    z-index: 1;
  }
  /deep/ .van-tab {
    font-size: 16px;
  }
  /deep/ .van-picker__cancel {
    color: #000;
    width: 48vw;
    height: 5vh;
    line-height: 5vh;
    box-shadow: 0px 4.5px 2px 0px rgba(0, 42, 105, 0.05);
    border-bottom: 1px solid #c0c0c08c;
  }
  /deep/.van-picker__confirm {
    color: #fff;
    background: linear-gradient(
      45deg,
      rgba(74, 172, 249, 1) 33%,
      rgba(127, 214, 255, 1) 100%
    );
    border: none;
    width: 48vw;
    line-height: 5vh;
    height: 5vh;
  }
  /deep/ .van-datetime-picker {
    padding-bottom: 55px;
  }
  /deep/ .van-picker__toolbar {
    padding: 0px 5px;
    position: absolute;
    bottom: 0px;
  }
  /deep/ [class*="van-hairline"]::after {
    border: none;
  }
  /deep/ .van-dropdown-item__content {
    max-height: 56%;
  }
  /deep/ .van-cell {
    padding: 1px 16px;
    background: #f8f8fa;
  }
  /deep/ .van-cell__title {
    font-size: 14px;
  }
  .public_col {
    margin: 0px 15px 8px;
    background: #fff;
    font-size: 11px;
    box-shadow: 0px 9px 4px 0px rgba(0, 42, 105, 0.05);
    border-radius: 5px;
    padding: 4px 0px;
  }
  .task_Icon {
    width: 24px;
    height: 24px;
    padding: 6px 5px;
  }
  .task_Icon img {
    width: 100%;
    height: 100%;
  }
}
.demo-date-picker {
  margin: 8px;
}
.task_card {
  margin: 5px 15px 15px;
  background-color: #fff;
  font-size: 12px;
  padding-bottom: 1px;
  border-radius: 5px;
  box-shadow: 0px 9px 4px 0px rgba(0, 42, 105, 0.05);
  .task_card_title {
    text-align: left;
    padding: 20px 15px 15px;
    span:first-child {
      display: inline-block;
      width: 47px;
      height: 47px;
      line-height: 47px;
      border-radius: 50%;
      background: url("../../static/section/Avatar_default@2x.png") no-repeat;
      background-size: cover;
      color: #fff;
      text-align: center;
      font-size: 13px;
    }
    b {
      margin-left: 10px;
      font-size: 15px;
      font-weight: 400;
    }
  }
  ul {
    text-align: left;
    padding-left: 10vw;
    font-size: 12px;
  }
  p {
    text-align: right;
    margin-right: 10px;
    color: silver;
    font-size: 12px;
  }
}
i {
  font-style: normal;
}
.container {
  padding: 0px;
  margin: 0px;
}
.left {
  float: left;
}
.right {
  float: right;
  font-size: 14px;
}
.clearfix::after {
  content: "";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}
.clearfix {
  zoom: 1;
}
</style>
